FROM http-garden-soil:latest

RUN apt -y update \
 && apt -y upgrade \
 && apt -y install --no-install-recommends ruby ruby-rack

ARG APP_REPO
RUN git clone --recurse-submodules "$APP_REPO"

ARG APP_VERSION
ARG APP_BRANCH
RUN cd /app/webrick \
 && git pull origin "$APP_BRANCH" \
 && git checkout "$APP_VERSION" \
 && gem build \
 && gem install ./webrick*.gem

COPY garden.rb .

CMD ruby garden.rb
